package com.supreme.simpleserver.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.supreme.commonmybatis.mapper.RoleMapper;
import com.supreme.commonentity.mysql.primary.SysRole;
import com.supreme.commonboot.utils.AjaxResp;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(value = "role")
public class RoleController {

    @Resource
    private RoleMapper roleMapper;

    @GetMapping(value = "search")
    public AjaxResp searchTest() {
        QueryWrapper<SysRole> queryWrapper = new QueryWrapper<>();
        List<SysRole> selectList = this.roleMapper.selectList(queryWrapper);
        return new AjaxResp(selectList);
    }

    @PostMapping(value = "create")
    public AjaxResp createTest(@RequestBody SysRole role) {
        int insert = this.roleMapper.insert(role);
        return new AjaxResp(insert);
    }
}
